//
//  BZ_GHS_MessViewController.m
//  penzer
//
//  Created by caiyc on 2018/11/16.
//  Copyright © 2018年 caiyc. All rights reserved.
//

#import "BZ_GHS_MessViewController.h"
#import "BZMineRegualTableModel.h"
#import "BZMineRegularItemTableViewCell.h"
#import "BZ_GHS_SysMessViewController.h"
@interface BZ_GHS_MessViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,copy)NSMutableArray *table_Data;
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation BZ_GHS_MessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"消息";
    [self SetupTabView];
    [self configData];
    // Do any additional setup after loading the view from its nib.
}


-(void)configData
{
   
    NSArray *titles = @[@"系统通知",@"服务消息",@"活动消息"];
    for(int i =0;i<titles.count;i++){
        BZMineRegualTableModel*model = [BZMineRegualTableModel new];
        model.title = titles[i];
        model.canClick = 1;
        model.titleColor = RGBA(51, 51, 51,1);
        model.imageStr = @"";
        model.sub_title = @"";
        [self.table_Data addObject:model];
    }
    [self.tableView reloadData];
}



-(void)SetupTabView
{
    
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([BZMineRegularItemTableViewCell class]) bundle:nil]  forCellReuseIdentifier:NSStringFromClass([BZMineRegularItemTableViewCell class])];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.estimatedRowHeight = 200;
    self.tableView.rowHeight = UITableViewAutomaticDimension;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.table_Data.count;
}


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    BZMineRegularItemTableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:NSStringFromClass([BZMineRegularItemTableViewCell class])];
    [cell setModel:self.table_Data[indexPath.row]];
    return cell;
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    BZ_GHS_SysMessViewController *vc = [[BZ_GHS_SysMessViewController alloc]init];
    [self.navigationController pushViewController:vc animated:NO];
}

#pragma mark--getter&&setter
 -(NSMutableArray *)table_Data
{
     if(!_table_Data){
        _table_Data = [NSMutableArray array];
     }
     return _table_Data;
 }

@end
